package Panel;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;

import java.awt.Graphics2D;

import java.awt.RenderingHints;

import javax.swing.JPanel;

public class PanelJeu
  extends JPanel
{
  private int x;
  private int y;
  public PanelJeu()
  {
    x=20;
    y=20;
    try
    {
      jbInit();
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }
  }
  public void paintComponent( Graphics g)
  {   
    super.paintComponent(g);
    Graphics2D g2 = (Graphics2D) g;
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
    g2.setColor(Color.YELLOW);
    g2.fillOval(x,y,50,50);
    
  }
  public void gauche()
  {
    x -=5;
    repaint();
  }
  public void droit()
  {
    x +=5;
    repaint();
  }
  public void haut()
  {
    y -=5;
    repaint();
  }
  public void bas()
  {   
    y +=5;
    repaint();
  }
  private void jbInit()
    throws Exception
  {
    this.setLayout( null );
  }
}
